<?php

defined('MYLITS') ? '' : exit('No direct script access allowed');

/**
 * @version     1.0.0
 * @package     #_ engine
 * @license     GNU General Public License version 3
 * @author      Arfan Fudyartanto D N <arfan@#_.com> - http://engine.#_.com
 */

$query['get_user_list'] = "
SELECT
  `core_user_id` AS `id`,
  `core_user_name` AS `name`,
  `core_user_username` AS `username`
FROM `#__core_user`";

$query['add_user'] = "
INSERT INTO `#__core_user` (
  `core_user_username`,
  `core_user_email`,
  `core_user_name`,
  `core_user_password`
) VALUES ('?', '?', '?', '?')";

$query['dell_user'] = "
DELETE 
FROM
  `#__core_user` 
WHERE `core_user_id` = ?";

$query['get_group_list'] = "
SELECT 
  *
FROM
  `#__core_usergroup`";

$query['is_username_exist'] = "
SELECT 
  COUNT(*) AS `count` 
FROM
  `#__core_user` 
WHERE `core_user_username` = '?'";

$query['add_group_map'] = "
INSERT INTO `#__core_usergroup_map` (
  `core_usergroup_map_user_id`,
  `core_usergroup_map_usergroup_id`
) 
VALUES (?, ?)";

$query['get_user_detail'] = "
SELECT 
  `core_user_id`,
  `core_user_username`,
  `core_user_email`,
  `core_user_name` 
FROM
  `#__core_user` 
WHERE `core_user_id` = ?";

$query['get_user_group_list'] = "
SELECT 
GROUP_CONCAT(`core_usergroup_map_usergroup_id`) AS `group_id`
FROM `mylits_core_usergroup_map`
WHERE `core_usergroup_map_user_id` = ?";

$query['update_user'] = "
UPDATE 
  `#__core_user` 
SET
  `core_user_username` = '?',
  `core_user_email` = '?',
  `core_user_name` = '?'
WHERE `core_user_id` = '?'";

$query['delete_group_map'] = "
DELETE 
FROM
  `#__core_usergroup_map` 
WHERE `core_usergroup_map_user_id` = ?";

$query['update_password'] = "
UPDATE 
  `#__core_user` 
SET
  `core_user_password` = '?' 
WHERE `core_user_id` = ?"
?>
